package com.fps.controller;

import com.fps.domain.ResponseResult;
import com.fps.domain.entity.Post;
import com.fps.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/article")
public class PostController {
    @Autowired
    private PostService postService;

    @GetMapping("/hotArticleList")
    public ResponseResult hotPostList(){
        ResponseResult result =  postService.hotArticleList();
        return result;
    }

    @GetMapping("/articleList")
    public ResponseResult postList(Integer pageNum,Integer pageSize,Long categoryId){
        return postService.articleList(pageNum,pageSize,categoryId);
    }

    @GetMapping("/{id}")
    public ResponseResult getArticleDetail(@PathVariable("id") Long id){
        return postService.getPostDetail(id);
    }
}
